﻿using System.Collections.Generic;
using HK.Core.Common.Data;
using HK.Editor.GUIEx.Protocol.TreeView.Data;
using UnityEditor.IMGUI.Controls;

namespace HK.Editor.GUIEx.Protocol.TreeView.Control
{
    /// <summary>
    /// 事件委托 : Tree变更
    /// </summary>
    public delegate void TableTreeChanged();
    
    /// <summary>
    /// 接口 : 表树
    /// </summary>
    /// <typeparam name="TRow">树形 - 行类型</typeparam>
    /// <typeparam name="TBranch">树形数据类型</typeparam>
    public interface ITableTree<TRow, TBranch> 
        where TRow : TreeViewItem, ITreeViewRow<TBranch>
        where TBranch : JsonData, ITreeBranch
    {
        
        /// <summary>
        /// 容量
        /// </summary>
        int Capacity { get; }
        
        /// <summary>
        /// 行数据
        /// </summary>
        List<TreeViewItem> Rows { get; }
        
        /// <summary>
        /// 表树数据同期
        /// </summary>
        ITableTreeDataContainer<TBranch> DataContainer { get; }
        
        /// <summary>
        /// 检索Key
        /// </summary>
        string SearchKey { get; set; }
        
#region Events

        /// <summary>
        /// Changed Event
        /// </summary>
        event TableTreeChanged Changed;
        
        /// <summary>
        /// 列排序回调
        /// </summary>
        SortTableTree SortColumns { get; }
        
#endregion
        
        /// <summary>
        /// 刷新
        /// </summary>
        /// <param name="iDataContainer">数据容器</param>
        void Refresh(ITableTreeDataContainer<TBranch> iDataContainer);

    }
}
